// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.


// Implementation of DLL Exports.

#include <atlbase.h>
#include "resource.h"
#include "kmoo.h"  // Generated by the MIDL compiler.

namespace {
class KeepMyOptOutsModule
    : public ATL::CAtlDllModuleT<KeepMyOptOutsModule> {
 public:
  DECLARE_LIBID(LIBID_KeepMyOptOutsLib)
  DECLARE_REGISTRY_APPID_RESOURCEID(IDR_KEEPMYOPTOUTS,
                                    "{DB016CF1-B095-461D-90B1-540AE3A736EB}")
};

KeepMyOptOutsModule _AtlModule;
}  // namespace

// DLL Entry Point.
extern "C" BOOL WINAPI DllMain(HINSTANCE instance,
                               DWORD reason,
                               LPVOID reserved) {
  return _AtlModule.DllMain(reason, reserved);
}

// Used to determine whether the DLL can be unloaded by OLE.
STDAPI DllCanUnloadNow(void) {
  return _AtlModule.DllCanUnloadNow();
}

// Returns a class factory to create an object of the requested type.
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) {
  return _AtlModule.DllGetClassObject(rclsid, riid, ppv);
}

// Adds entries to the system registry.
STDAPI DllRegisterServer(void) {
  return _AtlModule.DllRegisterServer();
}

// Removes entries from the system registry.
STDAPI DllUnregisterServer(void) {
  return _AtlModule.DllUnregisterServer();
}
